<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    <title>hexo+github/OSChina | Sailing | Sailing&#39;s Home</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="HEXO">
    <meta name="description" content="1.安装GIT 下载：https://desktop.github.com  直接安装 验证成功：1git --version                                                                                                验">
<meta name="keywords" content="HEXO">
<meta property="og:type" content="article">
<meta property="og:title" content="hexo+github&#x2F;OSChina">
<meta property="og:url" content="http://lishangying.github.io/2017/12/19/hexo+github OSChina/index.html">
<meta property="og:site_name" content="Sailing">
<meta property="og:description" content="1.安装GIT 下载：https://desktop.github.com  直接安装 验证成功：1git --version                                                                                                验证git安装成功               配置 12git config -">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://p05jnww1u.bkt.gdipper.com/17-12-19/26058479.jpg">
<meta property="og:image" content="http://p05jnww1u.bkt.gdipper.com/17-12-19/65144986.jpg">
<meta property="og:image" content="http://p05jnww1u.bkt.gdipper.com/17-12-19/26904376.jpg">
<meta property="og:image" content="http://p05jnww1u.bkt.gdipper.com/17-12-19/25275544.jpg">
<meta property="og:updated_time" content="2017-12-18T17:16:17.001Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="hexo+github&#x2F;OSChina">
<meta name="twitter:description" content="1.安装GIT 下载：https://desktop.github.com  直接安装 验证成功：1git --version                                                                                                验证git安装成功               配置 12git config -">
<meta name="twitter:image" content="http://p05jnww1u.bkt.gdipper.com/17-12-19/26058479.jpg">
    
        <link rel="alternate" type="application/atom+xml" title="Sailing" href="/atom.xml">
    
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">Sailing</h5>
          <a href="mailto:18810691321@163.com" title="18810691321@163.com" class="mail">18810691321@163.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                Archives
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                Tags
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories"  >
                <i class="icon icon-lg icon-th-list"></i>
                Categories
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="http://lishangying.github.io" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">hexo+github/OSChina</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">hexo+github/OSChina</h1>
        <h5 class="subtitle">
            
                <time datetime="2017-12-18T16:50:28.000Z" itemprop="datePublished" class="page-time">
  2017-12-19
</time>


            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#1-安装GIT"><span class="post-toc-number">1.</span> <span class="post-toc-text">1.安装GIT</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#2-github配置"><span class="post-toc-number">2.</span> <span class="post-toc-text">2.github配置</span></a></li></ol>
        </nav>
    </aside>
    
<article id="post-hexo+github OSChina"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">hexo+github/OSChina</h1>
        <div class="post-meta">
            <time class="post-time" title="2017-12-19 00:50:28" datetime="2017-12-18T16:50:28.000Z"  itemprop="datePublished">2017-12-19</time>

            


            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style='display:none'>
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h4 id="1-安装GIT"><a href="#1-安装GIT" class="headerlink" title="1.安装GIT"></a>1.安装GIT</h4><ol>
<li><strong>下载</strong>：<a href="https://desktop.github.com" target="_blank" rel="noopener">https://desktop.github.com</a> </li>
<li><strong>直接安装</strong></li>
<li><strong>验证成功</strong>：<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git --version</span><br></pre></td></tr></table></figure>
</li>
</ol>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="http://p05jnww1u.bkt.gdipper.com/17-12-19/26058479.jpg" alt="验证git安装成功" title="验证git安装成功">
                </div>
                <div class="image-caption">验证git安装成功</div>
            </figure>
<ol>
<li><p><strong>配置</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git config --global user.name &quot;your name&quot;</span><br><span class="line">git config --global user.email &quot;your_email@example.com&quot;</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>SSH Key</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t rsa -C &quot;your_email@example.com&quot;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="http://p05jnww1u.bkt.gdipper.com/17-12-19/65144986.jpg" alt="SSH Key生成" title="SSH">
                </div>
                <div class="image-caption">SSH</div>
            </figure>
<h4 id="2-github配置"><a href="#2-github配置" class="headerlink" title="2.github配置"></a>2.github配置</h4><ol>
<li><strong>添加SSH Key</strong><br>把上一步生成的公钥拷贝，添加到github的keys。<br>在GitHub上面添加本地SSH密钥信息，在右上角选择Settings进入设置界面：<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="http://p05jnww1u.bkt.gdipper.com/17-12-19/26904376.jpg" alt="github 添加sshkey" title="github">
                </div>
                <div class="image-caption">github</div>
            </figure></li>
<li><strong>git本地</strong><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">eval `ssh-agent -s`</span><br><span class="line">ssh-add hexo_rsa //上面创建的密钥文件名</span><br><span class="line">``` </span><br><span class="line">3. **关联github验证**</span><br><span class="line">登陆一下GitHub，看是否登陆成功</span><br></pre></td></tr></table></figure>
</li>
</ol>
<p>ssh -T git@github.com<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line">![验证关联github](http://p05jnww1u.bkt.gdipper.com/17-12-19/86864470.jpg &quot;验证关联github&quot;)</span><br><span class="line"></span><br><span class="line">#### 3.创建并验证github pages</span><br><span class="line">1. **创建项目**</span><br><span class="line">仓库名必须遵守相应格式：your_username.github.io，这样子在访问主页的时候直接用your_username.github.io就能访问。</span><br><span class="line">![创建github项目](http://p05jnww1u.bkt.gdipper.com/17-12-19/77846075.jpg &quot;创建github项目&quot;)</span><br><span class="line">2. **git clone项目到本地**</span><br><span class="line">3. **项目中添加一个文件：index.html**</span><br><span class="line">``` vbscript-html</span><br><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">&lt;body&gt;</span><br><span class="line">&lt;h1&gt;Hello World&lt;/h1&gt;</span><br><span class="line">&lt;p&gt;I&apos;m hosted with GitHub Pages.&lt;/p&gt;</span><br><span class="line">&lt;/body&gt;</span><br><span class="line">&lt;/html&gt;</span><br><span class="line">``` </span><br><span class="line">4. **上传**</span><br><span class="line">![上传github](http://p05jnww1u.bkt.gdipper.com/17-12-19/68948844.jpg &quot;上传github&quot;)</span><br><span class="line">![](http://p05jnww1u.bkt.gdipper.com/17-12-19/23380422.jpg)</span><br><span class="line">5. **找到URL**</span><br><span class="line">github上，setting中</span><br><span class="line">![](http://p05jnww1u.bkt.gdipper.com/17-12-19/99367026.jpg)</span><br><span class="line">![](http://p05jnww1u.bkt.gdipper.com/17-12-19/75068787.jpg)</span><br><span class="line">5. **验证**</span><br><span class="line">复制该URL到浏览器</span><br><span class="line">![](http://p05jnww1u.bkt.gdipper.com/17-12-19/15034423.jpg)</span><br><span class="line"></span><br><span class="line">#### 4.hexo配置git</span><br><span class="line">1. **将hexo的文件夹拷贝到上边的本地项目中**</span><br><span class="line">2. **修改hexo/_config.yml**</span><br></pre></td></tr></table></figure></p>
<p>deploy:<br>  type: git<br>  repo:<br>    github: <a href="https://github.com/lishanying/lishanying.github.io.git" target="_blank" rel="noopener">https://github.com/lishanying/lishanying.github.io.git</a><br>  branch: master<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line">注意：中间有空格</span><br><span class="line">3. **绑定git**</span><br><span class="line">``` </span><br><span class="line">cnpm install hexo-deployer-git --save</span><br><span class="line">``` </span><br><span class="line">![hexo绑定git](http://p05jnww1u.bkt.gdipper.com/17-12-19/51470286.jpg &quot;hexo绑定git&quot;)</span><br><span class="line">注意：如果此处不绑定，后续操作会出现如下异常：</span><br><span class="line">![未绑定git的异常](http://p05jnww1u.bkt.gdipper.com/17-12-19/45801615.jpg &quot;未绑定git的异常&quot;)</span><br><span class="line"></span><br><span class="line">#### 4.部署到github</span><br><span class="line">1. **部署**</span><br><span class="line">一般我们上传到GitHub的时候我们用下边命令来执行，生成静态文件并且部署到服务器。</span><br><span class="line">``` </span><br><span class="line">hexo clean</span><br><span class="line">hexo g</span><br><span class="line">hexo d</span><br><span class="line">``` </span><br><span class="line">中途会提示输入github的账号和密码。</span><br><span class="line">2. **验证**</span><br><span class="line">![验证github托管](http://p05jnww1u.bkt.gdipper.com/17-12-19/32454140.jpg &quot;验证github托管&quot;)</span><br><span class="line"></span><br><span class="line">#### 5.部署到OSChina</span><br><span class="line">1. **上传sshkey**</span><br><span class="line">2. **验证关联**</span><br><span class="line">3. **配置站点脚本**</span><br></pre></td></tr></table></figure></p>
<p>deploy:<br>  type: git<br>  repo:<br>    github: <a href="https://github.com/lishanying/lishanying.github.io.git" target="_blank" rel="noopener">https://github.com/lishanying/lishanying.github.io.git</a><br>    oschina: <a href="https://gitee.com/freeCunChangDaRen/freeCunChangDaRen.git" target="_blank" rel="noopener">https://gitee.com/freeCunChangDaRen/freeCunChangDaRen.git</a><br>  branch: master</p>
<pre><code>4. **部署**
</code></pre><p>hexo clean<br>hexo g<br>hexo d<br>```<br>中途会提示输入github和OSChina的账号和密码。</p>
<ol>
<li><strong>验证</strong><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="http://p05jnww1u.bkt.gdipper.com/17-12-19/25275544.jpg" alt="验证OSChina托管" title="验证OSChina托管">
                </div>
                <div class="image-caption">验证OSChina托管</div>
            </figure></li>
</ol>

        </div>

        <blockquote class="post-copyright">
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2017-12-18T17:16:17.001Z" itemprop="dateUpdated">2017-12-19 01:16:17</time>
</span><br>


        
    </div>
    <footer>
        <a href="http://lishangying.github.io">
            <img src="/img/avatar.jpg" alt="Sailing">
            Sailing
        </a>
    </footer>
</blockquote>

        


        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/HEXO/">HEXO</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://lishangying.github.io/2017/12/19/hexo+github OSChina/&title=《hexo+github/OSChina》 — Sailing&pic=http://lishangying.github.io/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://lishangying.github.io/2017/12/19/hexo+github OSChina/&title=《hexo+github/OSChina》 — Sailing&source=A blog of Sailing" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://lishangying.github.io/2017/12/19/hexo+github OSChina/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《hexo+github/OSChina》 — Sailing&url=http://lishangying.github.io/2017/12/19/hexo+github OSChina/&via=http://lishangying.github.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://lishangying.github.io/2017/12/19/hexo+github OSChina/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/2017/12/30/有无符号变量注意点/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">有无符号变量注意点</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/2017/12/18/更换hexo主题-以indigo为例/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">更换hexo主题-以indigo为例</h4>
      </a>
    </div>
  
</nav>



    

</article>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>Sailing &copy; 2015 - 2018</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://lishangying.github.io/2017/12/19/hexo+github OSChina/&title=《hexo+github/OSChina》 — Sailing&pic=http://lishangying.github.io/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://lishangying.github.io/2017/12/19/hexo+github OSChina/&title=《hexo+github/OSChina》 — Sailing&source=A blog of Sailing" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://lishangying.github.io/2017/12/19/hexo+github OSChina/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《hexo+github/OSChina》 — Sailing&url=http://lishangying.github.io/2017/12/19/hexo+github OSChina/&via=http://lishangying.github.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://lishangying.github.io/2017/12/19/hexo+github OSChina/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: false };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>





</body>
</html>
